import request from "./../request";

/**
 * 登录方法
 * @param obj
 * @returns {Promise | Promise<unknown>}
 */
export function login(obj) {
  return request({
    url: "goUser/login",
    data: obj,
  });
}

/**
 * 分页查询
 * @param page 页码
 * @param limit 限制行数
 * @param userName 用户登录帐号/邮箱/手机号
 * @param remark 邀请码
 * @returns {Promise | Promise<unknown>}
 */
export function pagingQuery(page, limit, userName, remark) {
  return request({
    url: "goUser/pagingQuery",
    params: {page, limit, userName, remark}
  })
}

export function updateState(id, state) {
  return request({
    url: `goUser/${id}/${state}`,
    method: "PUT"
  });
}

export function deleteUser(id) {
  return request({
    url: `goUser/${id}`,
    method: "DELETE"
  });
}